/*
 * @Author: liu
 * @Date: 2024-04-19 23:23:26
 * @LastEditors: 鱿鱼溪学院
 * @LastEditTime: 2025-04-20 17:27:05
 * @FilePath: \yyx_ser_ts\app\router\decorator-router\demo.ts
 * @Description:
 * 天道酬勤
 */
import Router, { RouterContext } from 'koa-router'
import { get, post, controller, use, del } from '../decorator/index'
import commonMiddleware from '../../middleware/common'
import { Context } from 'koa'
import exp from 'constants'

@controller('/decorator-demo')
class DemoRouteModule {
  @get('/name')
  @use(commonMiddleware)
  async getName(ctx: RouterContext) {
    const { name } = ctx.request.query
    ctx.body = 'de'
  }

  @post('/aa')
  async postName(ctx: RouterContext) {
    const { name } = ctx.request.body
    ctx.body = {
      name: name
    }
  }

  @del('./admin')
  async delLesson(ctx: RouterContext) {
    const { name } = ctx.request.body
    ctx.body = {
      name: name
    }
  }
}

export default new DemoRouteModule()
